<?php
namespace App\Model;

use PhalApi\Model\NotORMModel as NotORM;

class WALLETTRADE extends NotORM
{

    protected function getTableName($id)
    {
        return 'wallet_trade';
    }

    public function getTransaction($uid = 0, $ico, $p) {
        $data = $this->getORM()
            ->limit(($p-1)*10, 10)
            ->where("fromuid = '$uid' or touid = '$uid'")
            ->where(['ico' => $ico])
            ->order('id desc')
            ->fetchAll();
        if(!empty($data))
            return $data;
    }

    public function getCounts($uid)
    {
        $data = $this->getORM()->where(['touid' => $uid])->where(['type' => 1])->count();
        if(!empty($data))
            return $data;
    }

}